using System;
using System.Collections.Generic;
using System.Text;

using SypConst.Garbage;
using SypEngine;

namespace SypEngine.TransferHandler
{
    public class SypTransferException : Exception
    {
    }

    public abstract class SypTransferHandler
    {
        protected SetText OutputMethod = null;

        public abstract int[] CheckSynchronizedPictures(string RootDir);

        public abstract void MakeDir(string DirPath);

        public abstract void RemoveDir(string DirPath);

        public abstract void DeleteFile(string FilePath);

        public abstract void SendFile(string LocalFilePath, string RemoteFilePath);

        public abstract void SetCurrentDirectory(string path);

        public abstract void Close();

        public SypTransferHandler(SetText OutMethod)
        {
            this.OutputMethod = OutMethod;
        }

        public static SypTransferHandler BuildSypTransfer(SetText outMethod, ConnectionMode mode, TransferConf SiteConf)
        {
            SypTransferHandler SypTransfer = null;
            switch (mode)
            {
                case ConnectionMode.FTP_MODE:
                    {
                        SypTransfer = new SypFtpTransferHandler(outMethod, SiteConf.Hostname, SiteConf.Port, SiteConf.Login, SiteConf.Password);
                        break;
                    }
                case ConnectionMode.SCP_MODE:
                    {
                        SypTransfer = new SypScpTransferHandler(outMethod, SiteConf.Hostname, SiteConf.Login, SiteConf.Password, SiteConf.RemoteDir, SiteConf.Port);
                        break;
                    }
                case ConnectionMode.DIRECT_MODE:
                    {
                        SypTransfer = new SypLocalTransferHandler(outMethod, SiteConf.RemoteDir);
                        break;
                    }
                default:
                    {
                        SypTransfer = new SypLocalTransferHandler(outMethod, SiteConf.RemoteDir);
                        break;
                    }
            }
            return SypTransfer;
        }
    }
}
